package com.xing.designmode;

import java.util.List;

import android.content.Context;
import android.os.Handler;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RadioGroup;
import com.xing.model.HsdDataResult;
import com.xing.model.HsdModelAnswer;
import com.xing.util.SurveyConstants;

public class QuestionAnswerFatory {
	
	
	public static QuestionAnswer createQuestionAnswer(String questionType,Context context,View view,LinearLayout parentLayout,RadioGroup radioGroup,String currentQuestionuuid,String researchuuid,String surveyuuid,Handler dealAnswerResultHandler,List<HsdDataResult> currrentSelectedHsdDataResultList
			,List<HsdModelAnswer> currentAnswerModelObjectList,String op_flag){
		QuestionAnswer questionAnswer = null;
		if (questionType.equals(SurveyConstants.QUESTION_MOLD_SINGLE)) {
			questionAnswer = new SingleQuestionAnswer();
			
		}else if (questionType.equals(SurveyConstants.QUESTION_MOLD_MULTIPLE)) {
			questionAnswer = new MutipleQuestionAnswer();
		}else if (questionType.equals(SurveyConstants.QUESTION_MOLD_SINGLEOPEN)) {
			questionAnswer = new SingleEditTextQuestionAnswer();
			
			/**
			 * 这句是什么作用
			 */
			questionAnswer.setCurrentQuestionuuid(currentQuestionuuid);
			
		}else if (questionType.equals(SurveyConstants.QUESTION_MOLD_GRIDSINGLE)) {
			/**
			 * 每行单选题
			 */
		     questionAnswer = new SingleChoiceEachRow1();
		     
		     
		}
		questionAnswer.setContext(context);
		questionAnswer.setView(view);
		questionAnswer.setSurveyuuid(surveyuuid);
		questionAnswer.setResearchuuid(researchuuid);
		questionAnswer.setCurrentAnswerModelObjectList(currentAnswerModelObjectList);
		questionAnswer.setCurrrentSelectedHsdDataResultList(currrentSelectedHsdDataResultList);
		questionAnswer.setDealAnswerResultHandler(dealAnswerResultHandler);
		questionAnswer.setAnswerParentLayout(parentLayout);
		questionAnswer.setOpFlag(op_flag);
		
		
		return questionAnswer;
	}
	

}
